package com.pavlinic.codegen;

import org.eclipse.jdt.core.dom.AST;
import org.eclipse.jdt.core.dom.ASTNode;
import org.eclipse.jdt.core.dom.ASTParser;
import org.eclipse.jdt.core.dom.CompilationUnit;

public abstract class ASTTestCase {
  public CompilationUnit parse(String code) {
    final ASTParser astParser = ASTParser.newParser(AST.JLS3);
    astParser.setSource(code.toCharArray());
    final ASTNode astNode = astParser.createAST(null);
    return (CompilationUnit) astNode;
  }
}